package com.sc.nft.entity.vo.ecology;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.sc.nft.enums.EcologyRewardsType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

@Data
public class AdminPageUserRewardsRecordsVO {

    private EcologyRewardsType rewardsType;

    @ApiModelProperty(value = "时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "奖励名称")
    private String linkName;

    @ApiModelProperty(value = "奖励数量")
    private String linkCount;

    public void setLinkCount(BigDecimal linkCount) {

        if(rewardsType == EcologyRewardsType.ECOLOGY_POINTS){
            this.linkCount = linkCount.setScale(2,BigDecimal.ROUND_DOWN).toPlainString();
        }

        if(rewardsType == EcologyRewardsType.EQUITY_PROPS){
            this.linkCount = linkCount.stripTrailingZeros().toPlainString();
        }

    }
}
